package com.tanger.task;

import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * @Description 测试任务执行类
 * @Author Hchenbin
 * @Date 2023-12-22 13:47
 * @Version 1.0
 */
@Slf4j
public class ExcuteTestJob extends QuartzJobBean {

    private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    @Override
    protected void executeInternal(JobExecutionContext context) {
        // get parameters
        context.getJobDetail()
                .getJobDataMap()
                .forEach( (k, v) ->
                        log.info("param, key:{}, value:{}", k, v)
                );
        log.info("Test Job执行时间: " + SDF.format(Calendar.getInstance().getTime()));
    }
}
